//双十一倒计时开始
function GetTime() {
    var EndTime = new Date('2021/11/11 00:00:00');
    var NowTime = new Date();
    var t = EndTime.getTime()-NowTime.getTime();
    var d = 0;
    var h = 0;
    var m = 0;
    var s = 0;
    if (t>0){
        d=Math.floor(t/1000/60/60/24)
        h=Math.floor(t/1000/60/60%24)
        m=Math.floor(t/100/60%60)
        s=Math.floor(t/1000%60)
    }
    document.getElementById('dayTime').innerHTML=d;
    document.getElementById('hourTime').innerHTML=h;
    document.getElementById('minTime').innerHTML=m;
    document.getElementById('secTime').innerHTML=s;
}
setInterval(GetTime,0)
//双十一倒计时结束
//轮播图开始
var items = document.getElementsByClassName('item');
var index = 0;
var clearActive = function () {
    for(var i = 0;i<items.length;i++){items[i].className='item'}
}
var goIndx = function () {
    clearActive();
    items[index].className = 'item active'
}

var goNext = function () {
    if(index < 4){
        index  ++;
    }
    else
        index = 0;
        goIndx();
    
}
var goPre = function () {
    if (index == 0) {
        index = 4
    }
    else{
        index --;
    }
    goIndx();
}

var goPreBtn = document.getElementById('left');
var goNextBtn = document.getElementById('right');

goPreBtn.addEventListener('click',function () {
    goPre();
})
goNextBtn.addEventListener('click',function () {
    goNext();
})
//轮播图结束
//抽奖开始
function CJ() {
    var number = document.getElementsByTagName('input');
    var luck = Math.floor(Math.random()*100+1);
    number[0].placeholder='恭喜您，获取了价值'+luck+'元代金券';
}
document.getElementById('cj').addEventListener('click',
    function (even) {
        CJ();
    }
)

//抽奖结束
